import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      redirect: '/scan/list',
    },
    {
      path: '/home',
      name: 'home',
      meta: {
        requiresAuth: true,
      },
      component: Home,
    },
    {
      path: '/scan',
      name: 'home',
      meta: {
        requiresAuth: true,
      },
      component: Home,
      children: [
        {
          path: 'list',
          name: 'list',
          meta: {
            requiresAuth: true,
          },
          component: () => import('./views/scan/scanlist.vue'),
        },
        {
          path: 'report',
          name: 'report',
          meta: {
            requiresAuth: true,
          },
          component: () => import('./views/scan/report.vue'),
        },
        {
          path: 'target',
          name: 'target',
          meta: {
            requiresAuth: true,
          },
          component: () => import('./views/scan/scantarget.vue'),
        },
        {
          path: 'portlist',
          name: 'portlist',
          meta: {
            requiresAuth: true,
          },
          component: () => import('./views/scan/scanportlist.vue'),
        },
      ],
    },
  ],
})
